package com.emcom.gotour.mvc.view;

import java.io.Serializable;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.springframework.context.MessageSource;

import com.emcom.gotour.mvc.message.CategoryMessage;
import com.emcom.gotour.mvc.message.TourMessage;

public class CategoryContentView implements Comparable<Object>, Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 9127086177326312282L;
	private String id;
	private String name;
	private String typeName;
	public CategoryContentView() {
	}
	public CategoryContentView(HttpServletRequest request, MessageSource messageSource) {
		this.id = CategoryMessage.ID.value(request, messageSource);
		this.name = CategoryMessage.Name.value(request, messageSource);
		this.typeName = TourMessage.TypeName.value(request, messageSource);
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getTypeName() {
		return typeName;
	}
	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}
	/**
	 * @see java.lang.Comparable#compareTo(Object)
	 */
	public int compareTo(Object object) {
		CategoryContentView myClass = (CategoryContentView) object;
		return new CompareToBuilder().append(this.typeName, myClass.typeName)
				.append(this.id, myClass.id).append(this.name, myClass.name)
				.toComparison();
	}
	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof CategoryContentView)) {
			return false;
		}
		CategoryContentView rhs = (CategoryContentView) object;
		return new EqualsBuilder().appendSuper(super.equals(object)).append(
				this.typeName, rhs.typeName).append(this.id, rhs.id).append(
				this.name, rhs.name).isEquals();
	}
	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(1744832413, 97695829).appendSuper(
				super.hashCode()).append(this.typeName).append(this.id).append(
				this.name).toHashCode();
	}
	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("name", this.name).append(
				"typeName", this.typeName).append("id", this.id).toString();
	}
}
